/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.com.intesal.seguridad.managed;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import sv.com.intesal.clases.Person;
import sv.com.intesal.seguridad.controlador.SessionControlador;

/**
 *
 * @author ejerez
 */
@ManagedBean(name = "principalManaged")
@SessionScoped
public class PrincipalManaged implements Serializable {

    private Person selectedPerson;

    public PrincipalManaged() {
        this.selectedPerson = new Person();
        this.fillPerson();
    }

    private void fillPerson() {

        try {
            SessionControlador sc = new SessionControlador();
            this.selectedPerson.setNombre_completo_em(sc.getEmpleado_Nombre() + " " + sc.getEmpleado_Apellido());
            this.selectedPerson.setUser(sc.getUser());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /*SETTER AND GETTERS*/
    public Person getSelectedPerson() {
        if (selectedPerson == null) {
            selectedPerson = new Person();
        }
        return selectedPerson;
    }

    public void setSelectedPerson(Person selectedPerson) {
        this.selectedPerson = selectedPerson;
    }

 
}
